package uutalk.netcloud.talk.model.bean;

import android.text.TextUtils;

import uutalk.netcloud.talk.base.util.thirdpart.QiNiuManager;
import uutalk.netcloud.talk.base.util.thirdpart.UserManager;

/**
 * Created by hujie on 17/4/10.
 */

public class TalkMessage {

    private long time;
    private String user_id;




    public void setTime(long time) {
        this.time = time;
    }

    public long getTime() {
        return time;
    }

    public UserInfo getUserInfo() {
        return DBEntityManager.getUserInfoById(user_id);
    }


    public void setUser_id(String user_id) {
        this.user_id = user_id;
    }

    public boolean isMe() {
        if (UserManager.getInstance().getLoginInfo().getDeviceId().equals(user_id)) {
            return true;
        }
        return false;
    }

    public String getName() {
        UserInfo userInfo = getUserInfo();
        if (userInfo != null && !TextUtils.isEmpty(userInfo.getName())) {
            return userInfo.getName();
        }
        return user_id;
    }

    public String getUserHead() {
        UserInfo userInfo = getUserInfo();
        if (userInfo != null && userInfo.getPicture() != null) {
            return QiNiuManager.QINIU_HOST + userInfo.getPicture();
        }
        return null;
    }
}
